package com.khiker.tree.binary_tree;

public class P112_HasPathSum {

	public boolean hasPathSum(TreeNode root, int targetSum) {
		if (root == null) {
			return false;
		}
		int l = targetSum - root.val;
		if (root.left == null && root.right == null) {
			return l == 0;
		}
		return hasPathSum(root.left, l) || hasPathSum(root.right, l);
	}


}


